import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
const Login = () => import(/* webpackChunName: "login_home_welcome" */ '@/views/login/Login.vue')
const Home = () => import(/* webpackChunName: "login_home_welcome" */ '@/views/home/Home.vue')
const Welcome = () => import(/* webpackChunName: "login_home_welcome" */ '@/views/home/Welcome.vue')
const Users = () => import(/* webpackChunName: "user" */ '@/views/user/User.vue')
const Report = () => import(/* webpackChunName: "report" */ '@/views/report/Report.vue')
const Order = () => import(/* webpackChunName: "order" */ '@/views/order/Order.vue')
const Goods = () => import(/* webpackChunName: "goods" */ '@/views/goods/Goods.vue')
const Add = () => import(/* webpackChunName: "add" */ '@/views/goods/Add.vue')
const Params = () => import(/* webpackChunName: "params" */ '@/views/params/Params.vue')
const Categories = () => import(/* webpackChunName: "params" */ '@/views/category/Category.vue')
Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/login',
    component: Login
  },
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/welcome',
    children: [
      {
        path: '/welcome',
        component: Welcome
      },
      {
        path: '/users',
        component: Users
      },
      // {
      //   path: '/rights',
      //   component: Rights
      // },
      // {
      //   path: '/roles',
      //   component: Roles
      // },
      {
        path: '/goods',
        component: Goods
      },
      {
        path: '/categories',
        component: Categories
      },
      {
        path: '/params',
        component: Params
      },
      {
        path: '/add',
        component: Add
      },
      {
        path: '/orders',
        component: Order
      },
      {
        path: '/reports',
        component: Report
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
